package com.souku.finance.application.dialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jungly.gridpasswordview.GridPasswordView;
import com.souku.finance.application.R;
import com.souku.finance.application.widget.MyTextView;

/**
 * Created by Android on 2017/1/17.
 */

public class CheckPaypwdDialog extends Dialog {

    protected ImageView ivClosed;
    protected TextView tvType;
    protected MyTextView tvMoney;
    protected GridPasswordView pswView;
    protected TextView tvResetpwd;
    private View.OnClickListener listener;
    private GridPasswordView.OnPasswordChangedListener pwdListener;
    private String money;
    private String title;

    public CheckPaypwdDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected CheckPaypwdDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    public CheckPaypwdDialog(Context context, String title, String money, View.OnClickListener listener,GridPasswordView.OnPasswordChangedListener pwdListener) {
        super(context, R.style.myDialogFull);
        this.listener = listener;
        this.money = money;
        this.title = title;
        this.pwdListener=pwdListener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_checkpaypwd);
        initView();
        tvMoney.setText(money);
        tvType.setText(title);
    }

    private void initView() {
        ivClosed = (ImageView) findViewById(R.id.iv_closed);
        ivClosed.setOnClickListener(listener);
        tvType = (TextView) findViewById(R.id.tv_type);
        tvMoney = (MyTextView) findViewById(R.id.tv_money);
        pswView = (GridPasswordView) findViewById(R.id.pswView);
        pswView.setOnPasswordChangedListener(pwdListener);
        tvResetpwd = (TextView) findViewById(R.id.tv_resetpwd);
        tvResetpwd.setOnClickListener(listener);
    }
}
